//
//  YBBlogCell.m
//  Cocoachina
//
//  Created by 尚往文化 on 17/9/13.
//  Copyright © 2017年 YBing. All rights reserved.
//

#import "YBBlogCell.h"
#import "Define.h"

@implementation YBBlogCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    for (int i=0; i<5; i++) {
        [self getLabel:i+1].layer.cornerRadius = 3;
    }
}

- (void)setBlog:(YBBlog *)blog
{
    _blog = blog;
    self.titleLabel.text = blog.title;
    self.descLabel.text = blog.desc;
    
    YBWeakSelf
    [blog.tag enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [weakSelf getLabel:idx+1].text = [NSString stringWithFormat:@"  %@  ", obj];
    }];
    
    self.timeLabel.text = [NSString stringWithFormat:@"%@  %@", blog.author, blog.time];
    self.readnumLabel.text = [NSString stringWithFormat:@"%@ %@ %@", blog.readnum, blog.commentnum, blog.likenum];
    
}

- (UILabel *)getLabel:(NSInteger)tag
{
    return [self.contentView viewWithTag:tag];
}

@end
